package configuration.dataObjects
{
	import mx.collections.ArrayCollection;
	import common.utils.DateManager;
	
	public class FilterOrderByDO
	{
		public var SEQUENCE:Number = 0;
		public var RECORD_TYPE:String = "";
		public var FILTER_NAME:String = "";
		public var ATTRIBUTE:String = "";
		public var ASC_DESC:String = "";
		public var USER_STAMP:String = "";
		public var DATE_TIME_STAMP:String = DateManager.GetTodayString();
		public var CREATE_BREAK:String = "";

		public function FilterOrderByDO()
		{
		}	
		
		public function Init(xmlObj:XML):void{				
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML = 
			<FilterOrderByDO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">			
				<SEQUENCE>{SEQUENCE}</SEQUENCE>
				<RECORD_TYPE>{RECORD_TYPE}</RECORD_TYPE>
				<FILTER_NAME>{FILTER_NAME}</FILTER_NAME>
				<ATTRIBUTE>{ATTRIBUTE}</ATTRIBUTE>
				<ASC_DESC>{ASC_DESC}</ASC_DESC>
				<USER_STAMP>{USER_STAMP}</USER_STAMP>
				<DATE_TIME_STAMP>{DATE_TIME_STAMP}</DATE_TIME_STAMP>
				<CREATE_BREAK>{CREATE_BREAK}</CREATE_BREAK>
			</FilterOrderByDO>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:FilterOrderByDO = new FilterOrderByDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}
	}
}